package cn.swh.guguanjia.service.impl;

import cn.swh.guguanjia.entity.SysUser;
import cn.swh.guguanjia.mapper.SysUserMapper;
import cn.swh.guguanjia.service.SysUserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service
@Transactional
public class SysUserServicelmpl extends BaseServicelmpl<SysUser, Long> implements SysUserService {

    @Autowired
    SysUserMapper sysUserMapper;

    @Override
    public PageInfo<SysUser> selectPage(int pageNum, int pageSize, Map<String, Object> map) {
        PageHelper.startPage(pageNum,pageSize);
        List<SysUser> sysUsers = sysUserMapper.selectPage(map);
        PageInfo<SysUser> pageInfo = new PageInfo<>(sysUsers);
        return pageInfo;
    }

    public List<SysUser> selectById(long rid){
        return sysUserMapper.selectById(rid);
    }

    public List<SysUser> selectNoRole( long rid,  long oid){
        return sysUserMapper.selectNoRole(rid,oid);
    }
}
